CentOS 6
Sponsored Link

Configure iSCSI Initiator (CentOS)
2014/08/05
 
Configure iSCSI Initiator.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |10.0.0.30 | 10.0.0.31| [ iSCSI Initiator  ] |
|     dlp.srv.world    +----------+----------+     www.srv.world    |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure iSCSI Initiator.
[root@www ~]#
yum -y install iscsi-initiator-utils
[root@www ~]#
vi /etc/iscsi/iscsid.conf
# line 56: uncomment

node.session.auth.authmethod = CHAP
# line 60,61: uncomment and set username and password which set on iSCSI Target

node.session.auth.username =
username

node.session.auth.password =
password
# discover target

[root@www ~]#
iscsiadm -m discovery -t sendtargets -p 10.0.0.30

Starting iscsid: Loading iSCSI transport class v2.0-870.
[  OK  ]
10.0.0.30:3260,1 iqn.2014-08.world.srv:target00

# confirm status after discovery

[root@www ~]#
iscsiadm -m node -o show

# BEGIN RECORD 6.2.0-873.10.el6
node.name = iqn.2014-08.world.srv:target00
node.tpgt = 1
node.startup = automatic
node.leading_login = No
...
...
...
node.conn[0].iscsi.IFMarker = No
node.conn[0].iscsi.OFMarker = No
# END RECORD

# login to target

[root@www ~]#
iscsiadm -m node --login

Logging in to [iface: default, target: iqn.2014-08.world.srv:target00, portal: 10.0.0.30,3260] (multiple)
Login to [iface: default, target: iqn.2014-08.world.srv:target00, portal: 10.0.0.30,3260] successful.

# show established session

[root@www ~]#
iscsiadm -m session -o show

tcp: [1] 10.0.0.30:3260,1 iqn.2014-08.world.srv:target00
# show partitions

[root@www ~]#
cat /proc/partitions

major minor  #blocks  name

   8        0  209715200 sda
   8        1     512000 sda1
   8        2  209202176 sda2
 253        0  200966144 dm-0
 253        1    8232960 dm-1
   8       16   83886080 sdb
# added new device provided from target as [sdb]
[2] It's possible to use iSCSI device like follows.
[root@www ~]#
yum -y install parted
# create a label

[root@www ~]#
parted --script /dev/sdb "mklabel msdos"

# create a partition

[root@www ~]#
parted --script /dev/sdb "mkpart primary 0% 100%"

# format with EXT4

[root@www ~]#
mkfs.ext4 /dev/sdb1
# mount

[root@www ~]#
mount /dev/sdb1 /mnt

[root@www ~]#
df -hT

Filesystem           Type   Size  Used Avail Use% Mounted on
/dev/mapper/vg_dlp-lv_root
                     ext4   189G  1.1G  179G   1% /
tmpfs                tmpfs  1.9G     0  1.9G   0% /dev/shm
/dev/sda1            ext4   485M   75M  385M  17% /boot
/dev/sdb1            ext4    79G  184M   75G   1% /mnt
 
Tweet